var HtmlWebpackPlugin = require('html-webpack-plugin');
var OpenBrowserPlugin = require('open-browser-webpack-plugin');
var path = require('path');
var CommonsChunkPlugin = require("webpack/lib/optimize/CommonsChunkPlugin");
console.log(CommonsChunkPlugin);
module.exports = {
  entry: {
    main: './src/main.js',
    main1:'./src/main1.js',
    lib:['jquery','vue']

    //chunk: ["./src/chunk1", "./src/chunk2"],
  }, 
  output: {
    path:path.resolve(__dirname,'build'),
    filename: '[name].js'
  },
  
  plugins: [
    new HtmlWebpackPlugin({
          filename: __dirname+'/build/html/login.html',
          template:__dirname+'/src/tpl/login.html',
          inject:'body',
          hash:true,
          chunks: ['lib','common']
    }),
    new HtmlWebpackPlugin({
          filename: __dirname+'/build/html/index.html',
          template:__dirname+'/src/tpl/index.html',
          inject:'head',
          hash:false
    }),
   new CommonsChunkPlugin({
       name:["common"],
       filename:"js/common.js",//忽略则以name为输出文件的名字，否则以此为输出文件名字
       minChunks:2
   })
  ]
};